from lib.ZPanel import ZPanel
from res.fun import _create_rect, _get_center
from lib.ZButton import ZButton

class BottomBar(ZPanel):
    def __init__(self , surface):
        super(BottomBar , self).__init__(surface , [103 , 52])
        self.screen = surface
        self.surface = _create_rect([255,255,255,60] , self.rect.size ,0)
        self.rect.topleft = _get_center(self.rect)
        self.startbtn = ZButton(self.surface , self._pos)

    def draw(self):
        if self.isRunning :
            self.startbtn.draw()
            self.screen.blit(self.surface , self.rect.topleft)

    def update(self , mouse_pos ):
        if self.isRunning :
            self.startbtn.update(mouse_pos)

    def click(self , mouse_pos , mouse_pressed):
        if self.isRunning :
            return self.startbtn.isclick(mouse_pos , mouse_pressed)
